home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Linux Cubed Series 3: Developer Tools
/
Linux Cubed Series 3 - Developer Tools.iso
/
devel
/
lang
/
lisp
/
guile-ii.src
/
guile-ii
/
guile-src
/
guile-docs
/
user
/
scm.info-2
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
GNU Info File
|
1995-06-08
|
48.1 KB
|
1,308 lines
This is Info file scm.info, produced by Makeinfo-1.55 from the input
file scm.texi.
File: scm.info, Node: Compiling And Linking, Next: Numeric, Prev: Packages, Up: Packages
Compiling And Linking
=====================
- Function: compile-file NAME1 NAME2 ...
If the HOBBIT compiler is installed in the
`(implementation-vicinity)', compiles the files NAME1 NAME2 ... to
an object file name NAME1<object-suffix>, where <object-suffix> is
the object file suffix for your computer (for instance, `.o').
nAME1 must be in the current directory. NAME2 ... can be in other
directories.
- Function: link-named-scm NAME MODULE1 ...
Creates a new SCM executable with name NAME. NAME will include
the object modules MODULE1 ... which can be produced with
compile-file.
If SCM has been compiled with `dynl.c' then the additional properties
of load and require (from [SLIB]) specified below are supported. The
`require' forms are preferred. The variable `*catalog*' can be
extended to define other requirable packages. See `Link.scm' for
details.
- Function: load FILENAME LIB1 ...
In addition to the [R4RS] requirement of loading Scheme
expressions if FILENAME is a Scheme source file, `load' will also
dynamically load/link object files (produced by `compile-file', for
instance). The object-suffix need not be given to load. For
example,
(load (in-vicinity (implementation-vicinity) "sc2"))
or (load (in-vicinity (implementation-vicinity) "sc2.o"))
or (require 'rev2-procedures)
or (require 'rev3-procedures)
will load/link `sc2.o' if it exists.
The LIB1 ... pathnames are for additional libraries which may be
needed for object files not produced by the Hobbit compiler. For
instance, crs is linked on Linux by
(load (in-vicinity (implementation-vicinity) "crs.o")
(usr:lib "ncurses") (usr:lib "c"))
or (require 'curses)
Turtlegr graphics library is linked by:
(load (in-vicinity (implementation-vicinity) "turtlegr")
(usr:lib "X11") (usr:lib "c") (usr:lib "m"))
or (require 'turtle-graphics)
And the string regular expression (*note Regular Expression
Pattern Matching::.) package is linked by:
(load (in-vicinity (implementation-vicinity) "rgx") (usr:lib "c"))
or
(require 'regex)
- Function: require 'DB
- Function: require 'WB
Either form will dynamically load the WB database system from the
wb:vicinity (`../wb/') specified in `Link.scm'. See
`scm/ANNOUNCE' for ftp sites where WB is available.
The following functions comprise the low-level Scheme interface to
dynamic linking. See the file `Link.scm' in the SCM distribution for
an example of their use.
- Function: dyn:link FILENAME
FILENAME should be a string naming an "object" or "archive" file,
the result of C-compiling. The `dyn:link' procedure links and
loads FILENAME into the current SCM session. If successfull,
`dyn:link' returns a "link-token" suitable for passing as the
second argument to `dyn:call'. If not successful, `#f' is
returned.
- Function: dyn:call NAME LINK-TOKEN
LINK-TOKEN should be the value returned by a call to `dyn:link'.
nAME should be the name of C function of no arguments defined in
the file named FILENAME which was succesfully `dyn:link'ed in the
current SCM session. The `dyn:call' procedure calls the C
function corresponding to NAME. If successful, `dyn:call' returns
`#t'; If not successful, `#f' is returned.
`dyn:call' is used to call the "init_..." function after loading
SCM object files. The init_... function then makes the
identifiers defined in the file accessible as Scheme procedures.
- Function: dyn:unlink LINK-TOKEN
LINK-TOKEN should be the value returned by a call to `dyn:link'.
The `dyn:unlink' procedure removes the previously loaded file from
the current SCM session. If successful, `dyn:unlink' returns
`#t'; If not successful, `#f' is returned.
- Function: usr:lib LIB
Returns the pathname of the C library named lib. For example:
`(usr:lib "m")' could return `"/usr/lib/libm.a"', the path of the
C math library.
File: scm.info, Node: Numeric, Next: Arrays, Prev: Compiling And Linking, Up: Packages
Numeric
=======
- Constant: most-positive-fixnum
The immediate integer closest to positive infinity. *Note
Configuration: (slib)Configuration.
- Constant: most-negative-fixnum
The immediate integer closest to negative infinity.
These procedures augment the standard capabilities in *Note Numerical
operations: (r4rs)Numerical operations.
- Function: sinh Z
- Function: cosh Z
- Function: tanh Z
Return the hyperbolic sine, cosine, and tangent of Z
- Function: asinh Z
- Function: acosh Z
- Function: atanh Z
Return the inverse hyperbolic sine, cosine, and tangent of Z
- Function: $sqrt X
- Function: $abs X
- Function: $exp X
- Function: $log X
- Function: $sin X
- Function: $cos X
- Function: $tan X
- Function: $asin X
- Function: $acos X
- Function: $atan X
- Function: $sinh X
- Function: $cosh X
- Function: $tanh X
- Function: $asinh X
- Function: $acosh X
- Function: $atanh X
Real-only versions of these popular functions. The argument X
must be a real number. It is an error if the value which should be
returned by a call to these procedures is *not* real.
- Function: $atan2 Y X
Computes `(angle (make-rectangular x y))' for real numbers Y and X.
- Function: $expt X1 X2
Returns real number X1 raised to the real power X2. It is an
error if the value which should be returned by a call to `$expt'
is not real.
File: scm.info, Node: Arrays, Next: I/O-Extensions, Prev: Numeric, Up: Packages
Arrays
======
* Menu:
* Conventional Arrays::
* Array Mapping::
* Uniform Array::
* Bit Vectors::
File: scm.info, Node: Conventional Arrays, Next: Array Mapping, Prev: Arrays, Up: Arrays
Conventional Arrays
-------------------
"Arrays" read and write as a `#' followed by the "rank" (number of
dimensions) followed by what appear as lists (of lists) of elements.
The lists must be nested to the depth of the rank. For each depth, all
lists must be the same length.
(make-array 'ho 3 3) =>
#2((ho ho ho) (ho ho ho) (ho ho ho))
Unshared conventional (not uniform) 0-based arrays of rank 1
(dimension) are equivalent to (and can't be distinguished from) vectors.
(make-array 'ho 3) => (ho ho ho)
When constructing an array, BOUND is either an inclusive range of
indices expressed as a two element list, or an upper bound expressed as
a single integer. So
(make-array 'foo 3 3) == (make-array 'foo '(0 2) '(0 2))
- Function: array? OBJ
Returns `#t' if the OBJ is an array, and `#f' if not.
- Function: make-array INITIAL-VALUE BOUND1 BOUND2 ...
Creates and returns an array that has as many dimensions as there
are BOUNDs and fills it with INITIAL-VALUE.
- Function: array-ref ARRAY INDEX1 INDEX2 ...
Returns the element at the `(index1, index2)' element in ARRAY.
- Function: array-in-bounds? ARRAY INDEX1 INDEX2 ...
Returns `#t' if its arguments would be acceptable to array-ref.
- Function: array-set! ARRAY NEW-VALUE INDEX1 INDEX2 ...
Sets the element at the `(index1, index2)' element in ARRAY to
NEW-VALUE. The value returned by array-set! is unspecified.
- Function: make-shared-array ARRAY MAPPER BOUND1 BOUND2 ...
`make-shared-array' can be used to create shared subarrays of other
arrays. The MAPPER is a function that translates coordinates in
the new array into coordinates in the old array. A MAPPER must be
linear, and its range must stay within the bounds of the old
array, but it can be otherwise arbitrary. A simple example:
(define fred (make-array #f 8 8))
(define freds-diagonal
(make-shared-array fred (lambda (i) (list i i)) 8))
(array-set! freds-diagonal 'foo 3)
(array-ref fred 3 3) => foo
(define freds-center
(make-shared-array fred (lambda (i j) (list (+ 3 i) (+ 3 j))) 2 2))
(array-ref freds-center 0 0) => foo
- Function: transpose-array ARRAY DIM0 DIM1 ...
Returns an array sharing contents with ARRAY, but with dimensions
arranged in a different order. There must be one DIM argument for
each dimension of ARRAY. DIM0, DIM1, ... should be integers
between 0 and the rank of the array to be returned. Each integer
in that range must appear at least once in the argument list.
The values of DIM0, DIM1, ... correspond to dimensions in the
array to be returned, their positions in the argument list to
dimensions of ARRAY. Several DIMs may have the same value, in
which case the returned array will have smaller rank than ARRAY.
examples:
(transpose-array '#2((a b) (c d)) 1 0) => #2((a c) (b d))
(transpose-array '#2((a b) (c d)) 0 0) => #1(a d)
(transpose-array '#3(((a b c) (d e f)) ((1 2 3) (4 5 6))) 1 1 0) =>
#2((a 4) (b 5) (c 6))
- Function: enclose-array ARRAY DIM0 DIM1 ...
DIM0, DIM1 ... should be nonnegative integers less than the rank
of ARRAY. ENCLOSE-ARRAY returns an array resembling an array of
shared arrays. The dimensions of each shared array are the same
as the DIMth dimensions of the original array, the dimensions of
the outer array are the same as those of the original array that
did not match a DIM.
An enclosed array is not a general Scheme array. Its elements may
not be set using `array-set!'. Two references to the same element
of an enclosed array will be `equal?' but will not in general be
`eq?'. The value returned by ARRAY-PROTOTYPE when given an
enclosed array is unspecified.
examples:
(enclose-array '#3(((a b c) (d e f)) ((1 2 3) (4 5 6))) 1) =>
#<enclosed-array (#1(a d) #1(b e) #1(c f)) (#1(1 4) #1(2 5) #1(3 6))>
(enclose-array '#3(((a b c) (d e f)) ((1 2 3) (4 5 6))) 1 0) =>
#<enclosed-array #2((a 1) (d 4)) #2((b 2) (e 5)) #2((c 3) (f 6))>
- Function: array-shape ARRAY
Returns a list of inclusive bounds of integers.
(array-shape (make-array 'foo '(-1 3) 5)) => ((-1 3) (0 4))
- Function: array-dimensions ARRAY
`Array-dimensions' is similar to `array-shape' but replaces
elements with a `0' minimum with one greater than the maximum. So:
(array-dimensions (make-array 'foo '(-1 3) 5)) => ((-1 3) 5)
- Function: array-rank OBJ
Returns the number of dimensions of OBJ. If OBJ is not an array,
`0' is returned.
- Function: array->list ARRAY
Returns a list consisting of all the elements, in order, of ARRAY.
- Function: array-copy! SOURCE DESTINATION
Copies every element from vector or array SOURCE to the
corresponding element of DESTINATION. DESTINATION must have the
same rank as SOURCE, and be at least as large in each dimension.
The order is unspecified.
- Function: serial-array-copy! SOURCE DESTINATION
Same as `array-copy!' but guaranteed to copy in row-major order.
- Function: array-fill! ARRAY FILL
Stores FILL in every element of ARRAY. The value returned is
unspecified.
- Function: array-equal? ARRAY0 ARRAY1 ...
Returns `#t' iff all arguments are arrays with the same shape, the
same type, and have corresponding elements which are either
`equal?' or `array-equal?'. This function differs from `equal?'
in that a one dimensional shared array may be ARRAY-EQUAL? but not
EQUAL? to a vector or uniform vector.
- Function: array-contents ARRAY
- Function: array-contents ARRAY STRICT
If ARRAY may be "unrolled" into a one dimensional shared array
without changing their order (last subscript changing fastest),
then `array-contents' returns that shared array, otherwise it
returns `#f'. All arrays made by MAKE-ARRAY and
MAKE-UNIFORM-ARRAY may be unrolled, some arrays made by
MAKE-SHARED-ARRAY may not be.
If the optional argument STRICT is provided, a shared array will
be returned only if its elements are stored internally contiguous
in memory.
File: scm.info, Node: Array Mapping, Next: Uniform Array, Prev: Conventional Arrays, Up: Arrays
Array Mapping
-------------
- Function: array-map! ARRAY0 PROC ARRAY1 ...
ARRAY1, ... must have the same number of dimensions as ARRAY0 and
have a range for each index which includes the range for the
corresponding index in ARRAY0. PROC is applied to each tuple of
elements of ARRAY1 ... and the result is stored as the
corresponding element in ARRAY0. The value returned is
unspecified. The order of application is unspecified.
- Function: serial-array-map! ARRAY0 PROC ARRAY1 ...
Same as ARRAY-MAP!, but guaranteed to apply PROC in row-major
order.
- Function: array-for-each PROC ARRAY0 ...
PROC is applied to each tuple of elements of ARRAY0 ... in
row-major order. The value returned is unspecified.
- Function: array-index-map! ARRAY PROC
applies PROC to the indices of each element of ARRAY in turn,
storing the result in the corresponding element. The value
returned and the order of application are unspecified.
One can implement ARRAY-INDEXES as
(define (array-indexes array)
(let ((ra (apply make-array #f (array-shape array))))
(array-index-map! ra (lambda x x))
ra))
Another example:
(define (apl:index-generator n)
(let ((v (make-uniform-vector n 1)))
(array-index-map! v (lambda (i) i))
v))
File: scm.info, Node: Uniform Array, Next: Bit Vectors, Prev: Array Mapping, Up: Arrays
Uniform Array
-------------
"Uniform Arrays" and vectors are arrays whose elements are all of the
same type. Uniform vectors occupy less storage than conventional
vectors. Uniform Array procedures also work on vectors,
uniform-vectors, bit-vectors, and strings.
PROTOTYPE arguments in the following procedures are interpreted
according to the table:
prototype type printing character
#t boolean (bit-vector) b
#\a char (string) a
integer >0 unsigned integer u
integer <0 signed integer e
1.0 float (single precision) s
1/3 double (double precision float) i
+i complex (double precision) c
() conventional vector
Unshared uniform character 0-based arrays of rank 1 (dimension) are
equivalent to (and can't be distinguished from) strings.
(make-uniform-array #\a 3) => "$q2"
Unshared uniform boolean 0-based arrays of rank 1 (dimension) are
equivalent to (and can't be distinguished from) *Note bit-vectors: Bit
Vectors.
(make-uniform-array #t 3) => #*000
==
#b(#f #f #f) => #*000
==
#1b(#f #f #f) => #*000
Other uniform vectors are written in a form similar to that of vectors,
except that a single character from the above table is put between `#'
and `('. For example, `'#e(3 5 9)' returns a uniform vector of signed
integers.
- Function: array? OBJ PROTOTYPE
Returns `#t' if the OBJ is an array of type corresponding to
PROTOTYPE, and `#f' if not.
- Function: make-uniform-array PROTOTYPE BOUND1 BOUND2 ...
Creates and returns a uniform array of type corresponding to
PROTOTYPE that has as many dimensions as there are BOUNDs and
fills it with PROTOTYPE.
- Function: array-prototype ARRAY
Returns an object that would produce an array of the same type as
ARRAY, if used as the PROTOTYPE for `make-uniform-array'.
- Function: list->uniform-array RANK PROT LST
- Function: list->uniform-vector PROT LST
Returns a uniform array of the type indicated by prototype PROT
with elements the same as those of LST. Elements must be of the
appropriate type, no coercions are done.
- Function: uniform-vector-fill! UVE FILL
Stores FILL in every element of UVE. The value returned is
unspecified.
- Function: uniform-vector-length UVE
Returns the number of elements in UVE.
- Function: dimensions->uniform-array DIMS PROTOTYPE FILL
- Function: dimensions->uniform-array DIMS PROTOTYPE
- Function: make-uniform-vector LENGTH PROTOTYPE FILL
- Function: make-uniform-vector LENGTH PROTOTYPE
Creates and returns a uniform array or vector of type
corresponding to PROTOTYPE with dimensions DIMS or length LENGTH.
If the FILL argument is supplied, the returned array is filled with
this value.
- Function: uniform-array-read! URA
- Function: uniform-array-read! URA PORT
- Function: uniform-vector-read! UVE
- Function: uniform-vector-read! UVE PORT
Attempts to read all elements of URA, in lexicographic order, as
binary objects from PORT. If an end of file is encountered during
uniform-array-read! the objects up to that point only are put into
URA (starting at the beginning) and the remainder of the array is
unchanged.
`uniform-array-read!' returns the number of objects read. PORT
may be omitted, in which case it defaults to the value returned by
`(current-input-port)'.
- Function: uniform-array-write URA
- Function: uniform-array-write URA PORT
- Function: uniform-vector-write UVE
- Function: uniform-vector-write UVE PORT
Writes all elements of URA as binary objects to PORT. The number
of of objects actually written is returned. PORT may be omitted,
in which case it defaults to the value returned by
`(current-output-port)'.
File: scm.info, Node: Bit Vectors, Prev: Uniform Array, Up: Arrays
Bit Vectors
-----------
Bit vectors can be written and read as a sequence of `0's and `1's
prefixed by `#*'.
#b(#f #f #f #t #f #t #f) => #*0001010
Some of these operations will eventually be generalized to other
uniform-arrays.
- Function: bit-count BOOL BV
Returns the number occurrences of BOOL in BV.
- Function: bit-position BOOL BV K
Returns the minimum index of an occurrence of BOOL in BV which is
at least K. If no BOOL occurs within the specified range `#f' is
returned.
- Function: bit-invert! BV
Modifies BV by replacing each element with its negation.
- Function: bit-set*! BV UVE BOOL
If uve is a bit-vector BV and uve must be of the same length. If
BOOL is `#t', uve is OR'ed into BV; If BOOL is `#f', the inversion
of uve is AND'ed into BV.
If uve is a unsigned integer vector all the elements of uve must be
between 0 and the `LENGTH' of BV. The bits of BV corresponding to
the indexes in uve are set to BOOL.
The return value is unspecified.
- Function: bit-count* BV UVE BOOL
Returns
(bit-count (bit-set*! (if bool bv (bit-invert! bv)) uve #t) #t).
BV is not modified.
File: scm.info, Node: I/O-Extensions, Next: Posix Extensions, Prev: Arrays, Up: Packages
I/O-Extensions
==============
If `'i/o-extensions' is provided (by linking in `ioext.o'), *Note Line
I/O: (slib)Line I/O, and the following functions are defined:
- Function: isatty? PORT
Returns `#t' if PORT is input or output to a serial non-file
device.
- Function: stat <PORT-OR-STRING>
Returns a vector of integers describing the argument. The argument
can be either a string or an open input port. If the argument is an
open port then the returned vector describes the file to which the
port is opened; If the argument is a string then the returned
vector describes the file named by that string. If there exists
no file with the name string, or if the file cannot be accessed
`#f' is returned. The elements of the returned vector are as
follows:
0 st_dev
ID of device containing a directory entry for this file
1 st_ino
Inode number
2 st_mode
File type, attributes, and access control summary
3 st_nlink
Number of links
4 st_uid
User ID of file owner
5 st_gid
Group ID of file group
6 st_rdev
Device ID; this entry defined only for char or blk spec files
7 st_size
File size (bytes)
8 st_atime
Time of last access
9 st_mtime
Last modification time
10 st_ctime
Last file status change time
- Function: getpid
Returns the process ID of the current process.
- Function: file-position PORT
Returns the current position of the character in PORT which will
next be read or written. If PORT is not open to a file the result
is unspecified.
- Function: file-set-position PORT INTEGER
Sets the current position in PORT which will next be read or
written. If PORT is not open to a file the action of
`file-set-position' is unspecified. The result of
`file-set-position' is unspecified.
- Function: reopen-file FILENAME MODES PORT
Closes port PORT and reopens it with FILENAME and MODES.
`reopen-file' returns `#t' if successful, `#f' if not.
- Function: duplicate-port PORT MODES
Creates and returns a "duplicate" port from PORT. Duplicate
*unbuffered* ports share one file position. MODES are as for
*Note open-file: Files and Ports.
- Function: redirect-port! FROM-PORT TO-PORT
Closes TO-PORT and makes TO-PORT be a duplicate of FROM-PORT.
`redirect-port!' returns TO-PORT if successful, `#f' if not. If
unsuccessful, TO-PORT is not closed.
- Function: opendir DIRNAME
Returns a "directory" object corresponding to the file system
directory named DIRNAME. If unsuccessful, returns `#f'.
- Function: readdir DIR
Returns the string name of the next entry from the directory DIR.
If there are no more entries in the directory, `readdir' returns a
`#f'.
- Function: rewinddir DIR
Reinitializes DIR so that the next call to `readdir' with DIR will
return the first entry in the directory again.
- Function: closedir DIR
Closes DIR and returns `#t'. If DIR is already closed,,
`closedir' returns a `#f'.
- Function: mkdir PATH MODE
The `mkdir' function creates a new, empty directory whose name is
PATH. The integer argument MODE specifies the file permissions
for the new directory. *Note The Mode Bits for Access Permission:
(libc)The Mode Bits for Access Permission, for more information
about this.
`mkdir' returns if successful, `#f' if not.
- Function: rmdir PATH
The `rmdir' function deletes the directory PATH. The directory
must be empty before it can be removed. `rmdir' returns if
successful, `#f' if not.
- Function: chdir FILENAME
Changes the current directory to FILENAME. If FILENAME does not
exist or is not a directory, `#f' is returned. Otherwise, `#t' is
returned.
- Function: getcwd
The function `getcwd' returns a string containing the absolute file
name representing the current working directory. If this string
cannot be obtained, `#f' is returned.
- Function: rename-file OLDFILENAME NEWFILENAME
Renames the file specified by OLDFILENAME to NEWFILENAME. If the
renaming is successful, `#t' is returned. Otherwise, `#f' is
returned.
- Function: chmod FILE MODE
The function `chmod' sets the access permission bits for the file
named by FILE to MODE. The FILE argument may be a string
containing the filename or a port open to the file.
`chmod' returns if successful, `#f' if not.
- Function: utime PATHNAME ACCTIME MODTIME
Sets the file times associated with the file named PATHNAME to
have access time ACCTIME and modification time MODTIME. `utime'
returns if successful, `#f' if not.
- Function: umask MODE
The function `umask' sets the file creation mask of the current
process to MASK, and returns the previous value of the file
creation mask.
- Function: fileno PORT
Returns the integer file descriptor associated with the port PORT.
If an error is detected, `#f' is returned.
- Function: access PATHNAME HOW
Returns `#t' if the file named by PATHNAME can be accessed in the
way specified by the HOW argument. The HOW argument can be the
`logior' of the flags:
0. File exists.
1. File is executable.
2. File is writable
4. File is readable
- Function: execl COMMAND ARG0 ...
- Function: execlp COMMAND ARG0 ...
Transfers control to program COMMAND called with arguments ARG0
.... For `execl', COMMAND must be an exact pathname of an
executable file. `execlp' searches for COMMAND in the list of
directories specified by the environment variable PATH. The
convention is that ARG0 is the same name as COMMAND.
If successful, this procedure does not return. Otherwise an error
message is printed and the integer `errno' is returned.
- Function: execv COMMAND ARGLIST
- Function: execvp COMMAND ARGLIST
Like `execl' and `execlp' except that the set of arguments to
COMMAND is ARGLIST.
- Function: putenv STRING
adds or removes definitions from the "environment". If the STRING
is of the form `NAME=VALUE', the definition is added to the
environment. Otherwise, the STRING is interpreted as the name of
an environment variable, and any definition for this variable in
the environment is removed.
Names of environment variables are case-sensitive and must not
contain the character `='. System-defined environment variables
are invariably uppercase.
`Putenv' is used to set up the environment before calls to
`execl', `execlp', `execv', `execvp', `system', or `open-pipe'
(*note open-pipe: I/O-Extensions.).
To access environment variables, use `getenv' (*note getenv:
(slib)System Interface.).
File: scm.info, Node: Posix Extensions, Next: Regular Expression Pattern Matching, Prev: I/O-Extensions, Up: Packages
Posix Extensions
================
If `'posix' is provided (by linking in `posix.o'), the following
functions are defined:
- Function: open-pipe STRING MODES
If the string MODES contains an r, returns an input port capable
of delivering characters from the standard output of the system
command STRING. Otherwise, returns an output port capable of
receiving characters which become the standard input of the system
command STRING. If a pipe cannot be created `#f' is returned.
- Function: open-input-pipe STRING
Returns an input port capable of delivering characters from the
standard output of the system command STRING. If a pipe cannot be
created `#f' is returned.
- Function: open-output-pipe STRING
Returns an output port capable of receiving characters which become
the standard input of the system command STRING. If a pipe cannot
be created `#f' is returned.
- Function: close-port PIPE
Closes the PIPE, rendering it incapable of delivering or accepting
characters. This routine has no effect if the pipe has already
been closed. The value returned is unspecified.
- Function: pipe
Returns `(cons RD WD)' where RD and WD are the read and write
(port) ends of a "pipe" respectively.
- Function: fork
Creates a copy of the process calling `fork'. Both processes
return from `fork', but the calling ("parent") process's `fork'
returns the "child" process's ID whereas the child process's
`fork' returns 0.
For a discussion of "ID"s *Note Process Persona: (GNU C Library)Process
Persona.
- Function: getppid
Returns the process ID of the parent of the current process. For
a process's own ID *Note getpid: I/O-Extensions.
- Function: getuid
Returns the real user ID of this process.
- Function: getgid
Returns the real group ID of this process.
- Function: getegid
Returns the effective group ID of this process.
- Function: geteuid
Returns the effective user ID of this process.
- Function: setuid ID
Sets the real user ID of this process to ID. Returns `#t' if
successful, `#f' if not.
- Function: setgid ID
Sets the real group ID of this process to ID. Returns `#t' if
successful, `#f' if not.
- Function: setegid ID
Sets the effective group ID of this process to ID. Returns `#t'
if successful, `#f' if not.
- Function: seteuid ID
Sets the effective user ID of this process to ID. Returns `#t' if
successful, `#f' if not.
- Function: kill PID SIG
The `kill' function sends the signal SIGNUM to the process or
process group specified by PID. Besides the signals listed in
*Note Standard Signals: (libc)Standard Signals, SIGNUM can also
have a value of zero to check the validity of the PID.
The PID specifies the process or process group to receive the
signal:
> 0
The process whose identifier is PID.
0
All processes in the same process group as the sender. The
sender itself does not receive the signal.
-1
If the process is privileged, send the signal to all
processes except for some special system processes.
Otherwise, send the signal to all processes with the same
effective user ID.
< -1
The process group whose identifier is `(abs PID)'.
A process can send a signal to itself with `(kill (getpid)
SIGNUM)'. If `kill' is used by a process to send a signal to
itself, and the signal is not blocked, then `kill' delivers at
least one signal (which might be some other pending unblocked
signal instead of the signal SIGNUM) to that process before it
returns.
The return value from `kill' is zero if the signal can be sent
successfully. Otherwise, no signal is sent, and a value of `-1' is
returned. If PID specifies sending a signal to several processes,
`kill' succeeds if it can send the signal to at least one of them.
There's no way you can tell which of the processes got the signal
or whether all of them did.
- Function: waitpid PID OPTIONS
The `waitpid' function suspends execution of the current process
until a child as specified by the PID argument has exited, or
until a signal is deliverd whose action is to terminate the
current process or to call a signal handling function. If a child
as requested by PID has already exited by the time of the call (a
so-called "zombie" process), the function returns immediately.
Any system resources used by the child are freed.
The value of PID can be one of:
< -1
which means to wait for any child process whose process group
ID is equal to the absolute value of
-1
which means to wait for any child process whose process group
ID is equal to the `(abs PID)'.
-1
which means to wait for any child process; this is the same
behaviour which wait exhibits.
0
which means to wait for any child process whose process group
ID is equal to that of the calling process.
> 0
which means to wait for the child whose process ID is equal
to the value of PID.
The value of OPTIONS is one of the following:
0. Nothing special.
1. (`WNOHANG') which means to return immediately if no child is
there to be waited for.
2. (`WUNTRACED') which means to also return for children which
are stopped, and whose status has not been reported.
3. Which means both of the above.
The return value is normally the process ID of the child process
whose status is reported. If the `WNOHANG' option was specified
and no child process is waiting to be noticed, the value is zero.
A value of `#f' is returned in case of error and `errno' is set.
For information about the `errno' codes *Note Process Completion:
(GNU C Library)Process Completion.
- Function: uname
You can use the `uname' procedure to find out some information
about the type of computer your program is running on.
Returns a vector of strings. These strings are:
0. The name of the operating system in use.
1. The network name of this particular computer.
2. The current release level of the operating system
implementation.
3. The current version level within the release of the operating
system.
4. Description of the type of hardware that is in use.
Some examples are `"i386-ANYTHING"', `"m68k-hp"',
`"sparc-sun"', `"m68k-sun"', `"m68k-sony"' and `"mips-dec"'.
- Function: getpw NAME
- Function: getpw UID
- Function: getpw
Returns a vector of information for the entry for `NAME', `UID',
or the next entry if no argument is given. The information is:
0. The user's login name.
1. The encrypted password string.
2. The user ID number.
3. The user's default group ID number.
4. A string typically containing the user's real name, and
possibly other information such as a phone number.
5. The user's home directory, initial working directory, or
`#f', in which case the interpretation is system-dependent.
6. The user's default shell, the initial program run when the
user logs in, or `#f', indicating that the system default
should be used.
- Function: setpwent #T
Rewinds the pw entry table back to the begining.
- Function: setpwent #F
- Function: setpwent
Closes the pw table.
- Function: getgr NAME
- Function: getgr UID
- Function: getgr
Returns a vector of information for the entry for `NAME', `UID',
or the next entry if no argument is given. The information is:
0. The name of the group.
1. The encrypted password string.
2. The group ID number.
3. A list of (string) names of users in the group.
- Function: setgrent #T
Rewinds the group entry table back to the begining.
- Function: setgrent #F
- Function: setgrent
Closes the group table.
- Function: getgroups
Returns a vector of all the supplementary group IDs of the process.
- Function: link OLDNAME NEWNAME
The `link' function makes a new link to the existing file named by
OLDNAME, under the new name NEWNAME.
`link' returns a value of `#t' if it is successful and `#f' on
failure.
- Function: chown FILENAME OWNER GROUP
The `chown' function changes the owner of the file FILENAME to
OWNER, and its group owner to GROUP.
`chown' returns a value of `#t' if it is successful and `#f' on
failure.
- Function: ttyname PORT
If port PORT is associated with a terminal device, returns a
string containing the file name of termainal device; otherwise
`#f'.
Unix Extensions
===============
If `'unix' is provided (by linking in `unix.o'), the following
functions are defined:
These "priveledged" and symbolic link functions are not in Posix:
- Function: symlink OLDNAME NEWNAME
The `symlink' function makes a symbolic link to OLDNAME named
NEWNAME.
`symlink' returns a value of `#t' if it is successful and `#f' on
failure.
- Function: readlink FILENAME
Returns the value of the symbolic link FILENAME or `#f' for
failure.
- Function: lstat FILENAME
The `lstat' function is like `stat', except that it does not
follow symbolic links. If FILENAME is the name of a symbolic
link, `lstat' returns information about the link itself; otherwise,
`lstat' works like `stat'. *Note I/O-Extensions::.
- Function: nice INCREMENT
Increment the priority of the current process by INCREMENT.
`chown' returns a value of `#t' if it is successful and `#f' on
failure.
- Function: acct FILENAME
When called with the name of an exisitng file as argument,
accounting is turned on, records for each terminating pro-cess are
appended to FILENAME as it terminates. An argument of `#f' causes
accounting to be turned off.
`acct' returns a value of `#t' if it is successful and `#f' on
failure.
- Function: mknod FILENAME MODE DEV
The `mknod' function makes a special file with name FILENAME and
modes MODE for device number DEV.
`mknod' returns a value of `#t' if it is successful and `#f' on
failure.
- Function: sync
`sync' first commits inodes to buffers, and then buffers to disk.
sync() only schedules the writes, so it may return before the
actual writing is done. The value returned is unspecified.
File: scm.info, Node: Regular Expression Pattern Matching, Next: Line Editing, Prev: Posix Extensions, Up: Packages
Regular Expression Pattern Matching
===================================
These functions are defined in `rgx.c' using a POSIX or GNU "regex"
library. If your computer does not support regex, a package is
available via ftp from `prep.ai.mit.edu:/pub/gnu/regex-0.12.tar.gz'.
For a description of regular expressions, *Note syntax: (regex)syntax.
- Function: regcomp PATTERN [FLAGS]
Compile a "regular expression". Return a compiled regular
expression, or an integer error code suitable as an argument to
`regerror'.
FLAGS in `regcomp' is a string of option letters used to control
the compilation of the regular expression. The letters may consist
of:
`n'
newlines won't be matched by `.' or hat lists; ( `[^...]' )
`i'
ignore case.
only when compiled with _GNU_SOURCE:
`0'
allows dot to match a null character.
`f'
enable GNU fastmaps.
- Function: regerror ERRNO
Returns a string describing the integer ERRNO returned when
`regcomp' fails.
- Function: regexec RE STRING
Returns `#f' or a vector of integers. These integers are in
doublets. The first of each doublet is the index of STRING of the
start of the matching expression or sub-expression (delimited by
parentheses in the pattern). The last of each doublet is index of
STRING of the end of that expression. `#f' is returned if the
string does not match.
- Function: regmatch? RE STRING
Returns `#t' if the PATTERN such that REGEXP = (regcomp PATTERN)
matches STRING as a POSIX extended regular expressions. Returns
`#f' otherwise.
- Function: regsearch RE STRING [START [LEN]]
- Function: regsearchv RE STRING [START [LEN]]
- Function: regmatch RE STRING [START [LEN]]
- Function: regmatchv RE STRING [START [LEN]]
`Regsearch' searches for the pattern within the string.
`Regmatch' anchors the pattern and begins matching it against
string.
`Regsearch' returns the character position where RE starts, or
`#f' if not found.
`Regmatch' returns the number of characters matched, `#f' if not
matched.
`Regsearchv' and `regmatchv' return the match vector is returned
if RE is found, `#f' otherwise.
RE
may be either:
1. a compiled regular expression returned by `regcomp';
2. a string representing a regular expression;
3. a list of a string and a set of option letters.
STRING
The string to be operated upon.
START
The character position at which to begin the search or match.
If absent, the default is zero.
*Compiled _GNU_SOURCE and using GNU libregex only:*
When searching, if START is negative, the absolute value of
START will be used as the start location and reverse searching
will be performed.
LEN
The search is allowed to examine only the first LEN
characters of STRING. If absent, the entire string may be
examined.
- Function: string-split RE STRING
- Function: string-splitv RE STRING
`String-split' splits a string into substrings that are separated
by RE, returning a vector of substrings.
`String-splitv' returns a vector of string positions that indicate
where the substrings are located.
- Function: string-edit RE EDIT-SPEC STRING [COUNT]
Returns the edited string.
EDIT-SPEC
Is a string used to replace occurances of RE. Backquoted
integers in the range of 1-9 may be used to insert
subexpressions in RE, as in `sed'.
COUNT
The number of substitutions for `string-edit' to perform. If
`#t', all occurances of RE will be replaced. The default is
to perform one substitution.
File: scm.info, Node: Line Editing, Next: Curses, Prev: Regular Expression Pattern Matching, Up: Packages
Line Editing
============
These procedures provide input line editing and recall.
These functions are defined in `edline.c' and `Iedline.scm' using the
"editline" or GNU "readline" libraries available from:
* `ftp.sys.toronto.edu:/pub/rc/editline.shar'
* `prep.ai.mit.edu:pub/gnu/readline-2.0.tar.gz'
When `Iedline.scm' is loaded, if the current input port is the default
input port and the environment variable EMACS is not defined,
line-editing mode will be entered.
- Function: default-input-port
Returns the initial `current-input-port' SCM was invoked with
(stdin).
- Function: default-output-port
Returns the initial `current-output-port' SCM was invoked with
(stdout).
- Function: make-edited-line-port
Returns an input/output port that allows command line editing and
retrieval of history.
- Function: line-editing
Returns the current edited line port or `#f'.
- Function: line-editing BOOL
If BOOL is false, exits line-editing mode and returns the previous
value of `(line-editing)'. If BOOL is true, sets the current
input and output ports to an edited line port and returns the
previous value of `(line-editing)'.
File: scm.info, Node: Curses, Next: Sockets, Prev: Line Editing, Up: Packages
Curses
======
These functions are defined in `crs.c' using the "curses" library.
Unless otherwise noted these routines return `#t' for successful
completion and `#f' for failure.
- Function: initscr
Returns a port for a full screen window. This routine must be
called to initialize curses.
- Function: endwin
A program should call `endwin' before exiting or escaping from
curses mode temporarily, to do a system call, for example. This
routine will restore termio modes, move the cursor to the lower
left corner of the screen and reset the terminal into the proper
non-visual mode. To resume after a temporary escape, call *Note
refresh: Window Manipulation.
* Menu:
* Output Options Setting::
* Terminal Mode Setting::
* Window Manipulation::
* Output::
* Input::
* Curses Miscellany::
File: scm.info, Node: Output Options Setting, Next: Terminal Mode Setting, Prev: Curses, Up: Curses
Output Options Setting
----------------------
These routines set options within curses that deal with output. All
options are initially `#f', unless otherwise stated. It is not
necessary to turn these options off before calling `endwin'.
- Function: clearok WIN BF
If enabled (BF is `#t'), the next call to `force-output' or
`refresh' with WIN will clear the screen completely and redraw the
entire screen from scratch. This is useful when the contents of
the screen are uncertain, or in some cases for a more pleasing
visual effect.
- Function: idlok WIN BF
If enabled (BF is `#t'), curses will consider using the hardware
"insert/delete-line" feature of terminals so equipped. If
disabled (BF is `#f'), curses will very seldom use this feature.
The "insert/delete-character" feature is always considered. This
option should be enabled only if your application needs
"insert/delete-line", for example, for a screen editor. It is
disabled by default because
"insert/delete-line" tends to be visually annoying when used in
applications where it is not really needed. If
"insert/delete-line" cannot be used, curses will redraw the
changed portions of all lines.
- Function: leaveok WIN BF
Normally, the hardware cursor is left at the location of the window
cursor being refreshed. This option allows the cursor to be left
wherever the update happens to leave it. It is useful for
applications where the cursor is not used, since it reduces the
need for cursor motions. If possible, the cursor is made
invisible when this option is enabled.
- Function: scrollok WIN BF
This option controls what happens when the cursor of window WIN is
moved off the edge of the window or scrolling region, either from a
newline on the bottom line, or typing the last character of the
last line. If disabled (BF is `#f'), the cursor is left on the
bottom line at the location where the offending character was
entered. If enabled (BF is `#t'), `force-output' is called on the
window WIN, and then the physical terminal and window WIN are
scrolled up one line.
*Note:* in order to get the physical scrolling effect on the
terminal, it is also necessary to call `idlok'.
- Function: nodelay WIN BF
This option causes wgetch to be a non-blocking call. If no input
is ready, wgetch will return an eof-object. If disabled, wgetch
will hang until a key is pressed.
File: scm.info, Node: Terminal Mode Setting, Next: Window Manipulation, Prev: Output Options Setting, Up: Curses
Terminal Mode Setting
---------------------
These routines set options within curses that deal with input. The
options involve using ioctl(2) and therefore interact with curses
routines. It is not necessary to turn these options off before calling
`endwin'. The routines in this section all return an unspecified value.
- Function: cbreak
- Function: nocbreak
These two routines put the terminal into and out of `CBREAK' mode,
respectively. In `CBREAK' mode, characters typed by the user are
immediately available to the program and erase/kill character
processing is not performed. When in `NOCBREAK' mode, the tty
driver will buffer characters typed until a LFD or RET is typed.
Interrupt and flowcontrol characters are unaffected by this mode.
Initially the terminal may or may not be in `CBREAK' mode, as it is
inherited, therefore, a program should call `cbreak' or `nocbreak'
explicitly. Most interactive programs using curses will set
`CBREAK' mode.
*Note:* `cbreak' overrides `raw'. For a discussion of how these
routines interact with `echo' and `noecho' *Note read-char: Input.
- Function: raw
- Function: noraw
The terminal is placed into or out of `RAW' mode. `RAW' mode is
similar to `CBREAK' mode, in that characters typed are immediately
passed through to the user program. The differences are that in
`RAW' mode, the interrupt, quit, suspend, and flow control
characters are passed through uninterpreted, instead of generating
a signal. `RAW' mode also causes 8-bit input and output. The
behavior of the `BREAK' key depends on other bits in the terminal
driver that are not set by curses.
- Function: echo
- Function: noecho
These routines control whether characters typed by the user are
echoed by `read-char' as they are typed. Echoing by the tty
driver is always disabled, but initially `read-char' is in `ECHO'
mode, so characters typed are echoed. Authors of most interactive
programs prefer to do their own echoing in a controlled area of
the screen, or not to echo at all, so they disable echoing by
calling `noecho'. For a discussion of how these routines interact
with `echo' and `noecho' *Note read-char: Input.
- Function: nl
- Function: nonl
These routines control whether LFD is translated into RET and
`LFD' on output, and whether RET is translated into LFD on input.
Initially, the translations do occur. By disabling these
translations using `nonl', curses is able to make better use of
the linefeed capability, resulting in faster cursor motion.
- Function: resetty
- Function: savetty
These routines save and restore the state of the terminal modes.
`savetty' saves the current state of the terminal in a buffer and
`resetty' restores the state to what it was at the last call to
`savetty'.